<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="/css/admin_base.css">
	<script src='/js/MooTools-Core-1.5.1.js'></script>
	<script src='/js/MooTools-More-1.5.1-compressed.js'></script>
	<script src='/js/admin_base.js'></script>
	<title><{$title}></title>
</head>
<link rel="stylesheet" type="text/css" href="/css/admin_login.css">

<div >
	<div class='login_logo'></div>

	<div id='login' class='clear'>

		<form action=''id='login_form' class='clear' onSubmit="return false;">
		<div class='lenth_300 fl'><label>用户名:</label><input type='text' name='name' /></div>
		<div class='lenth_300 fl'><label>密  码:</label><input type='password' name='pwd' /></div>
		<div class='fl'><button id='login_button'>登陆</button></div>
		</form>
		<div id="error_show"></div>
	</div>
</div>
<script>
	window.addEvent('domready',function(){
		//登陆ajax
	    var msg_div = $("error_show");
	    var login_request = new Request.JSON({
	        url: '/index.php/admin/login/ajax_login_check',
	        method: 'post',
	        onRequest: function(){
	            msg_div.set('text', 'Loading...');
	        },
	        onSuccess: function(responseJson){
	            msg_div.set('html', responseJson.msg);
	            if(responseJson.flag){
	                location.href='/index.php/admin/index/index';
	            }
	        },
	        onFailure: function(){
	            msg_div.set('text', 'Sorry, your request failed :(');
	        }
	    }); 
	    // and to send it:
	    $("login_button").addEvent('click',function(){
	        
	        login_request.send($("login_form").toQueryString());
	    })
	})
</script>
</body>
</html>

